asp.net - how to set sqldatasource default value from database in c#? -
how set sqldatasource deafult value database field value. have coding like,
<asp:dropdownlist id="ddvehicle" runat="server" appenddatabounditems="true" cssclass="drop" datasourceid="sqldatasource4" datatextfield="vehicletype" datavaluefield="vehicleid"> <asp:listitem value="">-select-</asp:listitem> </asp:dropdownlist> <asp:sqldatasource id="sqldatasource4" runat="server" connectionstring="<%$ connectionstrings:taxiconnectionstring %>" selectcommand="select [vehicleid], [vehicletype] [vehiclemaster] ([vehicleid] = @vehicle or [status] = @status1)"> <selectparameters> <asp:parameter defaultvalue="???" name="vehicle" type="string" /> <asp:parameter defaultvalue="available" name="status1" type="string" /> </selectparameters> </asp:sqldatasource>
help me.
try this:
sqldatasource4.selectparameters.add("@vehicle", "vehicle value");
Comments
Post a Comment