c# - How to change direction of one column of datagridview from right to left? -
i have below code in asp.net datagrid view:
<asp:gridview id="gvstore" runat="server" allowpaging="true" allowsorting="true" autogeneratecolumns="false" cellpadding="4" emptydatatext="هیچ کالایی موجود نیست" font-names="tahoma" font-size="small" forecolor="#333333" horizontalalign="center" width="1000px" onrowdatabound="gvstore_rowdatabound" onselectedindexchanging="gvstore_selectedindexchanging" onpageindexchanging="gvstore_pageindexchanging" captionalign="right" datakeynames="store_id"> <pagersettings firstpagetext="ابتدا" lastpagetext="انتها" mode="numericfirstlast" nextpagetext="بعدی" previouspagetext="قبلی" /> <rowstyle backcolor="#fffbd6" forecolor="#333333" /> <columns> <asp:boundfield datafield="rownum" headertext="ردیف" /> <asp:boundfield datafield="store_id" headertext="شناسه" visible="false" /> <asp:boundfield datafield="groups_name" headertext="نام کالا"></asp:boundfield> <asp:boundfield datafield="str" headertext="مشخصات کالا"></asp:boundfield> <asp:boundfield datafield="plaque_no1" headertext="شماره اموال 1"></asp:boundfield> <asp:boundfield datafield="plaque_no2" headertext="شماره اموال 2"></asp:boundfield> <asp:boundfield datafield="buy_request_no" headertext="شماره درخواست" ></asp:boundfield> <asp:boundfield datafield="contract_no" headertext="شماره قرارداد"></asp:boundfield> <asp:boundfield headertext="تاریخ ورود" datafield="bdate"></asp:boundfield> <asp:boundfield headertext="محل بودجه" datafield="budjet_name"></asp:boundfield> <asp:commandfield selecttext="جزئیات درخواست" showselectbutton="true" /> </columns> <footerstyle backcolor="#990000" font-bold="true" forecolor="white" /> <pagerstyle backcolor="#ffcc66" forecolor="#333333" horizontalalign="center" /> <selectedrowstyle backcolor="#ffcc66" font-bold="true" forecolor="navy" /> <headerstyle backcolor="#990000" font-bold="false" font-size="small" forecolor="white" /> <alternatingrowstyle backcolor="white" /> </asp:gridview>
how can change direction of 1 column of right left? me please ?
you can use below change text direction right left.
gridview1.style[htmltextwriterstyle.direction] = "rtl";
particular cell
gridview1.rows[0].cells[1].style[htmltextwriterstyle.direction] = "rtl";
for left right
gridview1.style[htmltextwriterstyle.direction] = "ltr"; gridview1.rows[0].cells[1].style[htmltextwriterstyle.direction] = "ltr";
here link full reference.
Comments
Post a Comment